<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>map parsing demo</title>
  	<script src="common.js"></script>
  	<script src="map.js"></script>
  	<style>
  	select {
  	  width: 150px;
  	}
  	</style>
	</head>
	<script>
vx = 0;
vy = 0;
avatars = new Array();  
  
function onLoad() {
  // initialize canvas
  canvas = document.getElementById('canvas');
	context = canvas.getContext('2d');

  // load map
  map = new Map('maps/009-2.tmx');
  map.x0 = 95-10;
  map.y0 = 30-7;
}

function draw() {
  // draw scene
  context.save();
  
  // map background
  map.draw(map.x0,map.y0,20,15,map.ground,map.over);

  context.restore();
}

function Ovocie() {
  var that = new Array();

  that[0] = 'jablko';
  that[1] = 'hruska';
  that[2] = 'slivka';

  that.hello = function() {
    return "hello "+Math.random();
  }
  
  return that;
}

var ovocie = new Ovocie();

function test() {
  debug('test '+ovocie.length+' '+ovocie.hello());
  var s1 = ovocie.hello;
  ovocie = ovocie.splice(0,1);
  ovocie.hello = s1;
  debug('test '+ovocie.length+' '+ovocie.hello());
  debug('test '+ovocie.length+' '+ovocie.hello());
  
  
  
}
	</script>
	<body onload="onLoad()">

    <button onclick="draw()">draw</button>
    <button onclick="test()">test</button>

		<canvas id="canvas" width="640" height="480" style="border: 1px solid black; background: #777; margin-left: 0px;">
		</canvas> 

	</body>
</html>
